﻿using System.Collections.Generic;

namespace Complaint.Models
{
    public interface IModel<T>
    {
        /// <summary>
        /// Retrieves all instances of the type T.
        /// </summary>
        /// <returns>The requested instances.</returns>
        IList<T> Retrieve();

        /// <summary>
        /// Creates the passed dto in the data store.
        /// </summary>
        /// <param name="dto">The data transfer object containing the new values.</param>
        void Create(T dto);

        /// <summary>
        /// Updates the passed dto in the data store.
        /// </summary>
        /// <param name="dto">The data transfer object containing the new values.</param>
        void Update(T dto);

        /// <summary>
        /// Deletes the passed dto from the data store.
        /// </summary>
        /// <param name="dto">The data transfer object to delete.></param>
        void Delete(T dto);

        /// <summary>
        /// Retrieves all instances of the type T with the matching name.
        /// </summary>
        /// <param name="name">The name of the instances to retrieve.</param>
        /// <returns>The requested instances.</returns>
        IList<T> FindByName(string name);

        /// <summary>
        /// Retrieves an instances of the type T with the matching id.
        /// </summary>
        /// <param name="id">The Id of the instance to retrieve.</param>
        /// <returns>The requested instances.</returns>
        T FindById(int id);
    }
}